import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import Cookie from 'js-cookie'

// const  tokenRequest=(token)=>({url, method, params, data})=>{
//     return request({
//         url,
//         method,
//         params: {...Object.assign({}, token, params)},
//         data: {...data}
//     })
// }

// export  const newRequest=tokenRequest({sessionKey: getToken() || "chino"})

const tokenRequest = (token) => ({ url, method, params, data }) => {
  return request({
    url,
    method,
    params: { ...Object.assign({}, { sessionKey: getToken() }, params) },
    data
  })
}

export const newRequest = tokenRequest({ token: 'sessionKey' })
